package EDesign23;

public class GTemplate {


    public abstract class Fridge {
        public void placeElephant(){
            System.out.println("开始装大象");
            openDoor();
            putElephant();
            closeDoor();
            System.out.println("结束");
        }

        public abstract void openDoor();

        public abstract void putElephant();

        public abstract void closeDoor();
    }

    public class VerticalFridge extends Fridge{
        @Override
        public void openDoor() {
            System.out.println("打开立式冰箱门");
        }

        @Override
        public void putElephant() {
            System.out.println("将大象站着放进去");
        }

        @Override
        public void closeDoor() {
            System.out.println("关上立式冰箱门");
        }
    }

    public class HorizontalFridge extends Fridge{
        @Override
        public void openDoor() {
            System.out.println("打开卧式冰箱门");
        }

        @Override
        public void putElephant() {
            System.out.println("将大象躺着放进去");
        }

        @Override
        public void closeDoor() {
            System.out.println("关上卧式冰箱门");
        }
    }

//    public static void main(String[] args) {
//        Fridge fridge;
//
//        fridge = new HorizontalFridge();
//        fridge.placeElephant();
//
//        System.out.println("---------I'm a line-----------");
//
//        fridge = new VerticalFridge();
//        fridge.placeElephant();
//    }

}


